function getData(url, param, func_success) {

  wx.request({
    url: url,
    data: param,
    method: "GET",
    header: {
      "Content-Type": "application/json"
    },
    success: func_success,
    fail: function (res) {
      wx.showToast({
        title: '网络错误请重试',
        icon: 'loading',
        duration: 2000
      })
    }

  });

}


function postData(url, param, func_success) {
  wx.request({
    url: url,
    data: param,
    method: "POST",
    header: {
      "Content-Type": "application/x-www-form-urlencoded"
    },
    success: func_success,
    fail: function (res) {
      wx.showToast({
        title: '网络错误请重试',
        icon: 'loading',
        duration: 2000
      })
    }
  });

}

function showToast(title) {
  wx.showToast({
    title: title,
    icon: 'none',
    duration: 1500,
    mask: true
  })
}



module.exports = {
  getData: getData,
  postData: postData,
  showToast: showToast
}